﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class DutyUIRule
    {
        private static DutyUIRule _NewInstance = new DutyUIRule();

        public static DutyUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new DutyUIRule();
                }

                return _NewInstance;
            }
        }


        public OutPutParams<List<WarehouseInfo>> GetPDAWarehouse(string warehouseDate)
        {
            try
            {
                OutPutParams<List<WarehouseInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<OutPutParams<List<WarehouseInfo>>>("GetPDAWarehouse", new object[] { warehouseDate });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }


        public int UpdatePDAWarehouseState(string warehouseDate, string userID)
        {
            try
            {
                int _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<int>("UpdatePDAWarehouseState", new object[] { warehouseDate, userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }

            return 0;
        }

        public int UpdatePDAWarehouseQty(string userID, List<WarehouseInfo> lstWarehouse)
        {
            int _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<WarehouseInfo>, int>("UpdatePDAWarehouseQty", new object[] { userID }, lstWarehouse);
            
            return _result;
        }


        public List<string> GetPDAWarehouseName(string userID)
        {
            List<string> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<string>>("GetPDAWarehouseName", new object[] { userID });

            return _result;
        }

        public List<string> GetPDAPickBatchNo(string userID)
        {
            List<string> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<string>>("GetPDAPickBatchNo", new object[] { userID });

            return _result;
        }

        public PickInfo GetPDAPickInfo(string batchNo, string warehouseName, string userID)
        {
            PickInfo _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<PickInfo>("GetPDAPickInfo", new object[] { batchNo, warehouseName, userID });
            return _result;
        }

        public List<PickItemInfo> GetPDAPickItemInfo(string pickID)
        {
            List<PickItemInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<PickItemInfo>>("GetPDAPickItemInfo", new object[] { pickID });

            return _result;
        }

        public bool SubmitPDAPick(string pickID, string batchDate, string state, string userID, List<PickItemInfo> lstPickItem)
        {
            bool _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<PickItemInfo>, bool>("SubmitPDAPick", new object[] { pickID, batchDate, state, userID }, lstPickItem);
            
            return _result;
        }

        public bool SavePDAPick(string userID, List<PickItemInfo> lstPickItem)
        {
            bool _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<PickItemInfo>, bool>("SavePDAPick", new object[] { userID }, lstPickItem);

            return _result;
        }



     
    }
}
